import React, { Component } from 'react';
import {
    View,
    Dimensions,
    Image,
    StyleSheet,
    Platform,
} from 'react-native';
import STRING from '../../const_string_zh_CN';
import { TabNavigator } from 'react-navigation'
import { Container, Content, Footer, FooterTab, Button, Icon, Text, Form, Item, Label, Input } from 'native-base';
import Carousel from 'react-native-looped-carousel';
const { width, height } = Dimensions.get('window');
import TabNav from '../../navigators/CourseTabNavigator';
import { connect } from 'react-redux';

class tab_class extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const { navigate } = this.props.navigation;
        const { login_info } = this.props;
        console.log('1111111111'+login_info.customRole);
        return (
            <Content >
                <Carousel
                    delay={2500}
                    style={{ height: height / 4, width: width }}
                    autoplay
                    bullets
                    currentPage={0}
                >
                    <Image
                        style={styles.Image}
                        source={require('../../images/rotateone1.png')}
                    />
                    <Image
                        style={styles.Image}
                        source={require('../../images/2.jpg')}
                    />
                     <Image
                        style={styles.Image}
                        source={require('../../images/rotateone1.png')}
                    />
                    <Image
                        style={styles.Image}
                        source={require('../../images/2.jpg')}
                    />
                    {/* <Image
                        style={styles.Image}
                        source={require('../../images/2.jpg')}
                    /> */}
                </Carousel>
                <TabNav screenProps={{ parentNavigation: this.props.navigation, role: login_info.customRole }} />
            </Content>
        );
    }
}
const styles = StyleSheet.create({
    Image: {
        height: height / 4, width: width
    },
}
);
function mapStateToProps(state) {
    return { login_info: state.login.login_info }
}
//通过login_info.customRole来进行判断，若为'teacher',显示STRING.class_tab_teach_name,若为'student',显示STRING.class_tab_study_name
//login_info.customRole=='student'?STRING.class_tab_study_name:STRING.class_tab_teach_name
function mapDispatchToProps(dispatch) {
    return {

    }
}
const Pagetab_class = connect(
    mapStateToProps,
    mapDispatchToProps
)(tab_class)
export default Pagetab_class;